package day01;

public class IndexOfTest {
    public static void main(String[] args) {
        String str = "hello ： helloworldhello  eclipse hello idea hello spring";

        int count =0;
        int index=0;
        //从0 开始  查找hello 返回下标

        while((index=str.indexOf("hello",index))>=0){
            index+="hello".length();
            count++;
        }
        System.out.println("count:"+count);
    }
}
